<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"/>
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib prefix="frame" uri="http://www.framework.com/taglib"%>

<html>
  <head>
        <link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css"></link>
     	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css"></link>
     	<!-- jqueryUI JS文件的引入 -->
	    <script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	    <!-- jqueryUI国际化 -->
	    <script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	    <!-- 开发使用的公用js方法 -->
	    <script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	    <!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	    <script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	    <script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
 </head>
	    <script type="text/javascript">
	    $(function(){
	       $('#t_deposit').datagrid({
	                     idField:'id',
	                     title:'保证金明细',
	                     url:'${ctx}/business/auctionReport/depositList',
	                     striped:true,//隔行变色
	                     loadMsg:"数据正在加载中.....",
	                     rownumbers:true,//显示序号
	                     singleSelect:true,
	                     pagination:true,	
	                     nowrap:false,                    
	                     pageSize:20,
	                     pageList:[10,20,40,60],
	                     columns:[[   
							 {field:'projectName',title:'项目名称',width:100,align:'center'},
							 {field:'projectCode',title:'项目编号',width:100,align:'center'},
							 {field:'projectType',title:'项目类型',width:100,align:'center'},
							 {field:'depositTypeExport',title:'保证金类型',width:100, align:'center',formatter:formatterDepositType},
							 {field:'transTime',title:'进账时间',width:100,align:'center'},
							 {field:'tnAmount',title:'借方发生额-进账(元)',width:50,align:'center'},
							 {field:'returnTime',title:'支出时间',width:100,align:'center'},
							 {field:'payDeposit',title:'贷方发生额-支出(元)',width:100,align:'center',formatter:formatterPayDeposit},
							 {field:'pk',title:'对方名称', width:100,align:'center',formatter:fromatterCompanyName},
							 {field:'inAcct',title:'对方账号',width:100,align:'center'},
							 {field:'bankName',title:'对方开户行名称', align:'center',width:200},
						  // {field:'',title:'备注',align:'center',width:150}
			   			 ]]

	       });
	    });            
	                   
                        function searchDeposit(){                      	
                        	 $('#t_deposit').datagrid('load', {    
             	    	       projectName:$("#projectName").val(),
             	    	       code:$("#code").val(),
             	    	       projectType:$("#projectType").combobox('getValue'),
             	    	       depositType:$("#depositType").combobox('getValue')
             	    		}); 
                        	
                        }	
                        
                        function resetSearch() {
							$("#banner").find("input").each(function() {
								$(this).val("");
							});
							
						}
                        
                    	//对方名称
						function fromatterCompanyName(val, row, index) {
							if (row.pk) {
								return row.pk.companyName;
							}
						}
                    	
						//保证金类型
						function formatterDepositType(val, row, index) {
								if(row.pk.depositType==0){
									return "投标保证金"
								  }else if(row.pk.depositType==1){
									return "履约保证金"
									}
								}
						
						//支出金额
						function formatterPayDeposit(val, row, index){
							if(row.status==1){
								return row.tnAmount;
							}else {
								return "";
							}
						}
						
					</script>
   

 
  
  <body>
     <div class="easyui-layout" style="width:100%;height:100%;">
       <div data-options="region:'north',border:false" style="padding: 4px;height: 56px;overflow: hidden;"id="banner">
    		<div class="easyui-panel" data-options="fit:true,border:true" >
    		<form id="search" method="post">
			<div class="queryContent" >			
				<table class="queryTable" >
					<tbody>
						<tr>
						    <th>保证金类型:</th>
						    <td>
								 <select class="easyui-combobox easyui-validatebox" id="depositType" name="depositType" style="width:150px;" data-options="validType:'comboVry'" > 
													    <option value="" >--保证金类型--</option>  
													    <option value="0">投标保证金</option>
													    <option value="1">履约保证金</option>   
								 </select>
							  </td>
							<th >项目类型</th>
							<td width="10%">
								<select class="easyui-combobox" name="projectType" id="projectType" style="width:120px;height: 25px;" maxlength="20" data-options="">
									<option value="">--请选择--</option>
									<c:forEach items="${projectTypeList}" var="type">
										<option value="${type.name}">${type.name}</option>
									</c:forEach>
								</select>
							</td>
							<th width="10%">项目名称:</th>
							<td width="10%">
							<input class="easyui-validatebox" type="text" name="projectName" id="projectName" maxlength="20" style="width:120px;"></input></td>
							<th>项目编号:</th>
							<td><input class="easyui-validatebox" type="text" name="code" maxlength="20" id="code" style="width:120px;"></input></td>
							<td><a href="javascript:void(0);" class="easyui-linkbutton" id="searchUser" onclick="searchDeposit();" style="width:60px;">统计</a>
							<a href="javascript:void(0);" class="easyui-linkbutton" id="resetSearch" onclick="resetSearch();" style="width:60px;" >清空</a></td>
						</tr>
					</tbody>
				</table>	
				</form>			
			</div>
		</div>
		</div>
		<div data-options="region:'center'">
		     <table id="t_deposit" data-options="fit:true,fitColumns:true,toolbar:'#goodstb'"></table>	
        </div>
        <div id="goodstb" style="display: none;">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-export" onclick="excelexport()"  plain="true">导出到Excel</a>
				</div>
		</div><!--导出Excel -->
			<input type="hidden" id="excel_error" value="${requestScope.excel_error }"/>
			<script type="text/javascript">
				//导出
				function excelexport(){
					$("form").attr("action","${ctx}/business/auctionReport/depositListExport")
					$("form").submit();
					var val=$("#excel_error").val();
					if(val!=""){//不为空提示错误消息
						 $.messager.alert("操作提示", val,"error");  
					}
				}
				
		    </script>
		
        
  </body>
</html>
